{% extends "include/base.html" %}
{% block title %}Новый пароль{% endblock %}
{% block content %}
{% load user_filters %}

{% if validlink %}

<div class="row justify-content-center">
    <div class="col-md-8 p-5">
        <div class="card">
            <div class="card-header">Введите новый пароль</div>
            <div class="card-body">

                <form method="post">
                    {% csrf_token %}

                    {% for field in form %}
                        <div class="form-group row" aria-required={% if field.field.required %}"true"{% else %}"false"{% endif %}>
                                <label for="{{ field.id_for_label }}" class="col-md-4 col-form-label text-md-right">{{ field.label }}{% if field.field.required %}<span class="required">*</span>{% endif %}</label>
                                <div class="col-md-6">
                                    {{ field|addclass:"form-control" }}
                                    {% if field.help_text %}
                                    <small id="{{ field.id_for_label }}-help" class="form-text text-muted">{{ field.help_text|safe }}</small>
                                    {% endif %}
                                </div>
                        </div>
                    {% endfor %}

                    <div class="col-md-6 offset-md-4">              
                        <button type="submit" class="btn btn-primary">
                            Назначить новый пароль
                        </button>
                    </div>
                </form>

            </div> <!-- card body -->
        </div> <!-- card -->
    </div> <!-- col -->
</div> <!-- row -->

{% else %}
<div class="row justify-content-center">
    <div class="col-md-8 p-5">
        <div class="card">
            <div class="card-header">Ошибка</div>
            <div class="card-body">
                <p>Ссылка сброса пароля содержит ошибку или устарела.</p>
            </div> <!-- card body -->
        </div> <!-- card -->
    </div> <!-- col -->
</div> <!-- row -->
{% endif %}

{% endblock %}